/** @file
 *
 * Declaration of wiigi State Machine classes
 */
#ifndef WII_WI_SM_H
#define WII_WI_SM_H


#include <map>
#include <string>
#include <wiigi/c_Singleton.h>

namespace wiigi
{
   class c_Engine; 
   
   /**
    * virtual base for application to create states from
    */   
   class c_AppState 
   {
   public:
      /**
       * constructor
       *
       * @param Name Textual name of state
       */
      c_AppState( std::string Name ) :
         m_Engine( 0 ),
         m_Name( Name )
      {
      }
      
      /**
       * Associates this state with a engine
       *
       * @param Engine Pointer to an engine instance
       */
      void setEngine( c_Engine* Engine )
      {
         m_Engine = Engine;
      }
      
      /**
       * Called once when the engine transitions to this state
       */
      virtual void Enter( void ) = 0;
      
      /**
       * Called once when the engine transitions from this state
       */
      virtual void Exit( void )  = 0;
      
      /**
       * Called ever frame as long as this state is current
       */
      virtual void Run( void )   = 0;
      
      /**
       * Returns name of this state
       *
       * @retval Name of state
       */
      const std::string& getName( void ) const
      {
         return m_Name;
      }
   private:
      /**
       * default constructor (unimplemented)
       */
      c_AppState( void );
      
   protected:
      c_Engine*  m_Engine;

   private:
      std::string m_Name;

   };
   
}

#endif //WII_WI_SM_H
